import React from 'react';
import {Table, Row, Col, Form, Input, Icon, InputNumber, Radio, DatePicker, Select, Upload, Button, Switch, Modal, Popconfirm, Tabs, message} from 'antd';
import moment from 'moment'
import OperatorConstant from "../../utils/OperatorConstant";

const R = require('ramda');
const TabPane = Tabs.TabPane;
const FormItem = Form.Item;
const dateFormat = 'YYYY-MM-DD';


export default Form.create({wrappedComponentRef: true})(class ApprovalList extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            disabled: true,
            type: "",
        }
    }



    columns = [
        {title: '任务id', dataIndex: 'taskid', key: 'taskid'},
        {title: '节点', dataIndex: 'nodeName', key: 'nodeName'},
        {title: '审核人员', dataIndex: 'creatorName', key: 'creatorName'},
        {title: '审核意见', dataIndex: 'memo', key: 'memo'},
        {title: '提交时间', dataIndex: 'createtime', key: 'createtime'},
    ];


    render() {
        let dataSource = R.isNil(this.props.dataSource) ? {} : this.props.dataSource;
        let pagination = {
            showTotal: total => `共 ${total} 条数据`,
            pageSize: this.props.capital.approvalPage.size,
            total: this.props.capital.approvalPage.totalRow,
            showSizeChanger: true,
            current:this.props.capital.approvalPage.page,
            onShowSizeChange: (current, size) => {
                let newPage = this.props.capital.approvalPage;
                newPage.size = size;
                newPage.page = 1;
                this.props.dispatch({
                    type: 'capital/getApprovalById',
                    payload: {
                        id: R.isNil(dataSource.id) ? "" : dataSource.id,
                        page: newPage,
                    }
                });
            },
            onChange: (pageNumber, pageSize) => {
                let newPage = this.props.capital.approvalPage;
                newPage.page = pageNumber;
                this.props.dispatch({
                    type: 'capital/getApprovalById',
                    payload: {
                        id: R.isNil(dataSource.id) ? "" : dataSource.id,
                        page: newPage,
                    }
                });
            }
        }

        return (
            <div>
                <Table dataSource={this.props.capital.approvalList} columns={this.columns} bordered={true} size={'middle'} pagination={pagination} scroll={{ x: true }}/>
            </div>

        );
    }
})


